<extend name="Public/base"/>

<block name="body">
	<div class="main-title cf">
		<h2><if condition="I('get._action') eq 'add'">新增<else/>编辑</if>广告位</h2>
	</div>
	<!-- 表单 -->
	<form id="form" action="{:addons_url('Advertising://Advertising/update')}" method="post" class="form-horizontal">
		<!-- 基础文档模型 -->
		<div id="tab1" class="tab-pane in tab1">
			<div class="form-item cf">
				<label class="item-label">广告位名称<span class="check-tips">（请输入广告位名称）</span></label>
				<div class="controls">
					<input type="text" class="text input-large" name="title" value="{$info.title}">
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">广告类型<span class="check-tips">（请选择广告类型，默认为文字）</span></label>
				<div class="controls">
		            <label class="radio"><input type="radio" value="1" <eq name="info['type']" value="1">checked</eq>
                     <if condition="I('get._action') eq 'add'">checked</if> name="type">文字</label>
		            <label class="radio"><input type="radio" value="2" <eq name="info['type']" value="2">checked</eq> name="type">图片</label>
		            <label class="radio"><input type="radio" value="3" <eq name="info['type']" value="3">checked</eq> name="type">代码</label>
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">广告位宽度<span class="check-tips">（广告在前端展示的宽度）</span></label>
				<div class="controls">
					<input type="text" class="text input-large" name="width" value="{$info.width}">
				</div>
			</div>
			<div class="form-item cf">
				<label class="item-label">广告位高度<span class="check-tips">（广告在前端展示的高度）</span></label>
				<div class="controls">
					<input type="text" class="text input-large" name="height" value="{$info.height}">
				</div>
			</div>
            <div class="form-item cf">
				<label class="item-label">广告显示数量限制<span class="check-tips">（限制广告位同一时间可以显示的广告数量，默认只显示一个。）</span></label>
				<div class="controls">
					<input type="text" class="text input-large" name="same_limit" value="{$info.same_limit}">
				</div>
			</div>
            <div class="form-item cf">
				<label class="item-label">闲置显示广告内容<span class="check-tips">（广告位闲置时默认显示的广告内容）</span></label>
				<div class="controls">
                <label class="textarea">
					<textarea name="idle_content">{$info.idle_content}</textarea>
                    {:hook('adminArticleEdit', array('name'=>'idle_content','value'=>$info['idle_content']))}
                </label>
				</div>
			</div>
		</div>
		<input type="hidden" name="id" value="{$info.id}"/>
		<div class="form-item cf">
			<button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button onclick="javascript:history.back(-1);return false;" class="btn btn-return">返回</button> 
		</div>
	</form>
</block>

<block name="script">
<script type="text/javascript">
$(function(){
	$('#submit').click(function(){
		$('#form').submit();
	});
});
</script>
</block>